package com.mf.pte.selection;

import com.ptc.cipjava.intseq;
import com.ptc.cipjava.jxthrowable;
import com.ptc.pfc.pfcAssembly.Assembly;
import com.ptc.pfc.pfcAssembly.ComponentPath;
import com.ptc.pfc.pfcAssembly.pfcAssembly;
import com.ptc.pfc.pfcCommand.DefaultUICommandActionListener;
import com.ptc.pfc.pfcModel.Model;
import com.ptc.pfc.pfcModelItem.ModelItem;
import com.ptc.pfc.pfcModelItem.ModelItemType;
import com.ptc.pfc.pfcSelect.Selection;
import com.ptc.pfc.pfcSelect.pfcSelect;
import com.ptc.pfc.pfcSession.Session;
import com.ptc.pfc.pfcSolid.Solid;
import com.ptc.wfc.wfcModelItem.WModelItem;
import com.ptc.wfc.wfcSession.WSession;
import com.ptc.wfc.wfcSolid.WSolid;

public class NestedDisplay extends DefaultUICommandActionListener {
    private Session session;
    private WSession wSession;

    public NestedDisplay(Session session,WSession wSession) {
        this.session = session;
this.wSession = wSession;
    }
    @Override
    public void OnCommand() throws jxthrowable {
        Model model = session.GetCurrentModel();
        Assembly assembly = (Assembly) model;
        intseq path = intseq.create();
        path.append(40);
//        path.append(43);
        ComponentPath componentPath = pfcAssembly.CreateComponentPath(assembly, path);
//        Selection selection = pfcSelect.CreateComponentSelection(componentPath);
//        selection.Display();
        WSolid solid = (WSolid) componentPath.GetLeaf();
        WModelItem modelItem = (WModelItem) solid.GetItemById(ModelItemType.ITEM_FEATURE, 43);


        if(modelItem.IsHidden()){
            modelItem.Unhide();
        }else {
            modelItem.Hide();
        }
    }
}
